package com.example.travel.controller;

import com.example.travel.entity.Scenic;
import com.example.travel.entity.ScenicImg;
import com.example.travel.entity.bo.OrderformBO;
import com.example.travel.entity.dto.OrderformDTO;
import com.example.travel.entity.dto.ScenicDTO;
import com.example.travel.service.IScenicService;
import com.example.travel.util.ResultUtil;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ScenicContriller")
public class ScenicContriller {

    @Autowired
    private IScenicService scenicService;

    /**
     * 查询景点信息
     * @param scenicDTO
     * @return
     */
    @GetMapping("/queryScenicPage")
    public PageInfo<Scenic> queryScenicPage(ScenicDTO scenicDTO){
        return scenicService.queryScenicPage(scenicDTO);
    }

    /**
     * 景点详情页图片信息查询
     * @param scenicImg
     * @return
     */
    @GetMapping("/queryImgInfomation")
    public List<ScenicImg> queryImgInfomation(ScenicImg scenicImg){
        return scenicService.queryImgInfomation(scenicImg);
    }

    /**
     * 景点下单预订
     * @param orderformDTO
     * @return
     */
    @PostMapping("/placeAnOrder")
    public boolean placeAnOrder(OrderformDTO orderformDTO){
        return scenicService.placeAnOrder(orderformDTO);
    }

    /**
     * 查询景点订单信息
     * @param orderformDTO
     * @return
     */
    @GetMapping("/queryOrderForm")
    public ResultUtil queryOrderForm(OrderformDTO orderformDTO){
        PageInfo<OrderformBO> pageInfo = scenicService.queryOrderForm(orderformDTO);
        return ResultUtil.ok(pageInfo);
    }




}
